PEP 544 – Protocols: Structural subtyping (static duck typing)
Using Protocols
Modules as implementations of protocols
モジュールの属性をProtocolで定義する例
@runtime_checkable decorator and narrowing types by isinstance()
The typing module will define a special @runtime_checkable class decorator that provides the same semantics for class and instance checks as for collections.abc classes, essentially making them “runtime protocols”:
@runtime_checkableはruntimeプロトコルとしている
runtime_checkableの仕組みが続く